﻿Public Class clsProdSpec
    ' 查询规格信息
    Public Function getSpecNameByID(_prod_spec_id As String) As String
        Dim rtn As String = ""
        Dim szSql As String = ""
        szSql &= "SELECT  prod_spec_name  FROM sf.t_prod_spec "
        szSql &= " where  factory_id =? and prod_spec_id=? order by prod_spec_id"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", _prod_spec_id)
        If IsNothing(dt) OrElse dt.Rows.Count = 0 Then
            rtn = ""
        Else
            rtn = dt.Rows(0)("prod_spec_name")
        End If
        Return rtn
    End Function
    ' 查询规格信息
    Public Function selectAllbySpecId(_prod_spec_id As String) As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT * "
        szSql &= "  FROM sf.t_prod_spec "
        szSql &= "  WHERE factory_id = ?"
        szSql &= "  and  prod_spec_id = ?"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS", _prod_spec_id)
        If IsNothing(dt) Then
            selectAllbySpecId = New DataTable
        Else
            selectAllbySpecId = dt
        End If
    End Function

    Public Function getSpecANDName() As DataTable
        Dim szSql As String = ""
        szSql &= "SELECT prod_spec_id || '  (' || prod_spec_name  || ')'as mst_name ,prod_spec_id as mst_id  FROM sf.t_prod_spec "
        szSql &= " where  factory_id =? and prod_spec_name<>'' order by prod_spec_id"

        Dim dt As DataTable = DBacs.ExecuteSql(szSql, -1, "TS")
        If IsNothing(dt) Then
            getSpecANDName = New DataTable
        Else
            getSpecANDName = dt
        End If
    End Function

End Class
